// 装饰器应用场景

var Modal = (function () {
    var modal = null  
    return function () {
        if (!modal) {
            modal = document.createElement("div")
            modal.innerHTML = "dianwo"
            modal.style.display = "none"
            document.body.appendChild(modal)
        }

        return modal
    }
})()

const mo = new Modal()
const mo2 = new Modal()
const mo3 = Modal()

console.log(mo === mo2)
console.log(mo2 === mo3)
console.log(mo === mo3)